package com.kanavi.stand.controller;

import com.common.boot.common.CommonResult;
import com.kanavi.stand.entity.Test;
import com.kanavi.stand.service.TestService;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author tanghailan
 * @create 2021年09月11日 16:35
 */
@RestController
@Slf4j
public class TestController {

  @Autowired
  private TestService testService;

  @PostMapping("/add")
  public CommonResult<String> add(@RequestBody Test test) {
    testService.add(test);
    return CommonResult.success("ok");
  }

  @GetMapping("/findAll")
  public CommonResult<List<Test>> findAll() {
    return CommonResult.success(testService.findAll());
  }
}
